package com.jianjian.mapper;

import com.jianjian.pojo.Brand;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @author Zsir
 * @create 2021-12-06 21:29
 */
public interface BrandMapper {

    //分页条件查询
    List<Brand> selectTPage(@Param("begin") int begin,@Param("size") int size,@Param("brand") Brand brand);
    //分页条件查询的总数
    int selectTCount();


    //分页查询
    List<Brand> selectAllPage(@Param("begin") int begin,@Param("size") int size);

    //查询所有数据的总数
    int selectCount();

    //删除多条数据
    void deleteByIdAllBrand( @Param("id") int [] id);


//    查询所有数据
    @Select("select * from tb_brand")
    @ResultMap("bra")
    List<Brand> selectAllBrand();

    //增加一条数据
@Insert("insert into tb_brand(id,brand_name,company_name,ordered,description,status) values(null,#{brandName},#{companyName},#{ordered},#{description},#{status})")
    void addBrand(Brand brand);

    //修改一条数据
    @Update("update tb_brand set brand_name=#{brandName},company_name=#{companyName},ordered=#{ordered},description=#{description},status=#{status} where id = #{id}")
    void updateBrand(Brand brand);

    //删除一条数据
    @Delete("delete from tb_brand where id =#{id}")
    void deleteByIdBrand(@Param("id") int id);



}
